package com.jdcjk.project.setting.view;

import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageButton;
import android.widget.TextView;

import com.jdcjk.R;
import com.jdcjk.base.view.BaseActivity;
import com.jdcjk.project.setting.presenter.SettingPresenter;

/**
 * Created by Administrator on 2017/2/15 0015.
 */

public class AboutUsActivity extends BaseActivity<SettingPresenter> {
    //顶栏标题textView
    private TextView barTitle_textview;

    //backButton
    private ImageButton back_button;
    //app版本号textview
    private TextView appLevel_textview;

    @Override
    public int getLayoutId() {
        return R.layout.activity_about_us;
    }

    @Override
    public void initContentView(Bundle savedInstanceState) {
        appLevel_textview = (TextView) findViewById(R.id.app_level_tv);
        barTitle_textview = (TextView) findViewById(R.id.bar_title_textview);
        barTitle_textview.setText(R.string.about_us);
        back_button = (ImageButton) findViewById(R.id.back_btn);
        back_button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }

    @Override
    public void initData() {
        super.initData();
        //设置版本号信息
        try {
            PackageManager pm = this.getPackageManager();
            PackageInfo pi = pm.getPackageInfo(getApplication().getPackageName(), 0);
            appLevel_textview.setText(pi.versionName);
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
        }
    }
}
